/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mvp.levelup.threads;

/**
 *
 * @author WORKSPOT2
 */
public class MyThread extends Thread
{

    private boolean work = true;
    
    public MyThread(){
        super("THIS IS MY THREAD!");
    }
    
    @Override
    public void run()
    {
        try
        {
            int tmp = 0;
            for (int i = 0; i < 100 && work; i++)
            {
                tmp = tmp + i;
                System.out.println("Tmp: " + tmp);
                Thread.sleep(1000);
            }
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
        System.out.println("End Of run");
    }

    public void turnOff()
    {
        work = false;
    }
}
